gdk: Add GDK_DEBUG=nogl
authorBenjamin Otte <otte@redhat.com>
Thu, 16 Oct 2014 01:13:45 +0000 (03:13 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 16 Oct 2014 01:33:15 +0000 (03:33 +0200)
This is mostly useful for fallback testing.

I suppose if people want finer grained GL ability testing, they can use
Mesa environment variables to tune things.

docs/reference/gtk/running.sgml
gdk/gdk.c
gdk/gdkinternals.h
gdk/gdkwindow.c

index 321593a7f1b581ec6f79c3006193de6618e6182e..3e5f688e8ecfa2a5946351013105fd98b40a1d96 100644 (file)
@@ -399,6 +399,10 @@ nevertheless.
       <term>misc</term>
       <listitem><para>Miscellaneous information</para></listitem>
     </varlistentry>
+    <varlistentry>
+      <term>nogl</term>
+      <listitem><para>Turn off OpenGL. GDK will behave as if OpenGL support was not available.</para></listitem>
+    </varlistentry>
     <varlistentry>
       <term>nograbs</term>
       <listitem><para>Turn off all pointer and keyboard grabs</para></listitem>
index 0b2c3886b57a2d7cf613c1ceb67c603051eccdbe..e40cdea1a3e63626b5ff2beb22766298eaa322d5 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -149,6 +149,7 @@ static const GDebugKey gdk_debug_keys[] = {
   {"eventloop",     GDK_DEBUG_EVENTLOOP},
   {"frames",        GDK_DEBUG_FRAMES},
   {"settings",      GDK_DEBUG_SETTINGS},
+  {"nogl",          GDK_DEBUG_NOGL},
   {"opengl",        GDK_DEBUG_OPENGL},
 };
 
index d1eb2b1f7a352ebbbeed4a45b74eb57b6aca0c65..bb7b71a97e5c2ebd935a72144192f2c9bfc947db 100644 (file)
@@ -85,7 +85,8 @@ typedef enum {
   GDK_DEBUG_EVENTLOOP     = 1 << 10,
   GDK_DEBUG_FRAMES        = 1 << 11,
   GDK_DEBUG_SETTINGS      = 1 << 12,
-  GDK_DEBUG_OPENGL        = 1 << 13
+  GDK_DEBUG_NOGL          = 1 << 13,
+  GDK_DEBUG_OPENGL        = 1 << 14
 } GdkDebugFlag;
 
 typedef enum {
index 89a264c01d8e66789588c71fd3a77918572323d2..25d20b12821c40ffaaaf659c6b1e8a35430e0936 100644 (file)
@@ -2722,6 +2722,14 @@ gdk_window_ref_impl_surface (GdkWindow *window)
 GdkGLContext *
 gdk_window_get_paint_gl_context (GdkWindow *window, GError **error)
 {
+  if (_gdk_debug_flags & GDK_DEBUG_NOGL)
+    {
+      g_set_error_literal (error, GDK_GL_ERROR,
+                           GDK_GL_ERROR_NOT_AVAILABLE,
+                           _("GL support disabled via GDK_DEBUG"));
+      return NULL;
+    }
+
   if (window->impl_window->gl_paint_context == NULL)
     window->impl_window->gl_paint_context =
       GDK_WINDOW_IMPL_GET_CLASS (window->impl)->create_gl_context (window,